package com.vancouver.knows.ui.activity;

import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;
import uk.co.senab.photoview.PhotoViewAttacher.OnViewTapListener;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout.LayoutParams;

import com.squareup.picasso.Picasso;
import com.vancouver.knows.R;
import com.vancouver.knows.ui.base.BaseActivity;

public class ImageBrowserActivity extends BaseActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		PhotoView photoView = new PhotoView(this);
		photoView.setBackgroundColor(getResources().getColor(R.color.black));
		ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
		setContentView(photoView, lp);

		Intent intent = getIntent();
		if (intent == null) {
			return;
		}

		String url = intent.getStringExtra("url");
		Picasso.with(imContext).load(url).into(photoView);
		PhotoViewAttacher mAttacher = new PhotoViewAttacher(photoView);
		mAttacher.setOnViewTapListener(new OnViewTapListener() {

			@Override
			public void onViewTap(View view, float x, float y) {
				finish();
			}
		});
	}

}
